home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / dev.fmt / tty.man < prev   
Encoding:
Text File  |  1989-06-26  |  34.5 KB  |  925 lines

  1.  
  2.  
  3.  
  4. TTY                          Devices                          TTY
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      tty - general terminal interface
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<ssggttttyy..hh>>
  13.  
  14. DDEESSCCRRIIPPTTIIOONN
  15.      This section describes both a particular special file
  16.      //ddeevv//ttttyy and the terminal drivers used for conversational
  17.      computing.  The Sprite terminal driver is substantial subset
  18.      of the UNIX terminal driver, but there are a few features of
  19.      the UNIX driver that aren't yet implemented in Sprite (see
  20.      below for more details).
  21.  
  22.      LLiinnee ddiisscciipplliinneess..
  23.  
  24.      Sprite provides only a single line discipline, which behaves
  25.      like the ``new'' line discpline in UNIX.  The TIOCSETD _i_o_c_t_l
  26.      is not implemented in Sprite.
  27.  
  28.      TThhee ccoonnttrrooll tteerrmmiinnaall..
  29.  
  30.      Sprite does not yet implement controlling terminals.  The
  31.      TIOCNOTTY _i_o_c_t_l is not implemented.
  32.  
  33.      PPrroocceessss ggrroouuppss..
  34.  
  35.      Command processors such as _c_s_h(1) can arbitrate the terminal
  36.      between different _j_o_b_s by placing related jobs in a single
  37.      process group and associating this process group with the
  38.      terminal.  A terminal's associated process group may be set
  39.      using the TIOCSPGRP _i_o_c_t_l(2):
  40.  
  41.           iiooccttll((ffiillddeess,, TTIIOOCCSSPPGGRRPP,, &&ppggrrpp));;
  42.  
  43.      or examined using TIOCGPGRP, which returns the current pro-
  44.      cess group in _p_g_r_p.  The new terminal driver aids in this
  45.      arbitration by restricting access to the terminal by
  46.      processes which are not in the current process group; see
  47.      JJoobb aacccceessss ccoonnttrrooll below.
  48.  
  49.      MMooddeess..
  50.  
  51.      The terminal drivers have three major modes, characterized
  52.      by the amount of processing on the input and output charac-
  53.      ters:
  54.  
  55.      cooked    The normal mode.  In this mode lines of input are
  56.                collected and input editing is done.  The edited
  57.                line is made available when it is completed by a
  58.                newline, or when the _t__b_r_k_c character (normally
  59.                undefined) or _t__e_o_f_c character (normally an EOT,
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 19, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. TTY                          Devices                          TTY
  71.  
  72.  
  73.  
  74.                control-D, hereafter ^D) is entered.  A carriage
  75.                return is usually made synonymous with newline in
  76.                this mode, and replaced with a newline whenever it
  77.                is typed.  All driver functions (input editing,
  78.                interrupt generation, output processing such as
  79.                delay generation and tab expansion, etc.) are
  80.                available in this mode.
  81.  
  82.      CBREAK    This mode eliminates the character, word, and line
  83.                editing input facilities, making the input charac-
  84.                ter available to the user program as it is typed.
  85.                Flow control, literal-next and interrupt process-
  86.                ing are still done in this mode.  Output process-
  87.                ing is done.
  88.  
  89.      RAW       This mode eliminates all input processing and
  90.                makes all input characters available as they are
  91.                typed; no output processing is done either.
  92.  
  93.      The style of input processing can also be very different
  94.      when the terminal is put in non-blocking I/O mode; see the
  95.      FNDELAY flag described in _f_c_n_t_l(2).  In this case a _r_e_a_d(2)
  96.      from the control terminal will never block, but rather
  97.      return an error indication (EWOULDBLOCK) if there is no
  98.      input available.
  99.  
  100.      A process may also request that a SIGIO signal be sent it
  101.      whenever input is present and also whenever output queues
  102.      fall below the low-water mark.  To enable this mode the
  103.      FASYNC flag should be set using _f_c_n_t_l(2).
  104.  
  105.      IInnppuutt eeddiittiinngg..
  106.  
  107.      A UNIX terminal ordinarily operates in full-duplex mode.
  108.      Characters may be typed at any time, even while output is
  109.      occurring, and are only lost when the system's character
  110.      input buffers become completely choked, which is rare, or
  111.      when the user has accumulated the maximum allowed number of
  112.      input characters that have not yet been read by some pro-
  113.      gram.  Currently this limit is 256 characters.  In RAW mode,
  114.      the terminal driver throws away all input and output without
  115.      notice when the limit is reached.  In CBREAK or cooked mode
  116.      it refuses to accept any further input and, if in the new
  117.      line discipline, rings the terminal bell.
  118.  
  119.      Input characters are accepted in either parity (Sprite does
  120.      no checking right now and ignores the EVEN and ODD bits of
  121.      the flags word).
  122.  
  123.      It is possible to simulate terminal input using the TIOCSTI
  124.      _i_o_c_t_l, which takes, as its third argument, the address of a
  125.      character.  The system pretends that this character was
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 19, 1986                          2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. TTY                          Devices                          TTY
  137.  
  138.  
  139.  
  140.      typed on the argument terminal, which must be the control
  141.      terminal except for the super-user (this call is not in
  142.      standard version 7 UNIX).
  143.  
  144.      Input characters are normally echoed by putting them in an
  145.      output queue as they arrive.  This may be disabled by clear-
  146.      ing the ECHO bit in the flags word using the _s_t_t_y(3C) call
  147.      or the TIOCSETN or TIOCSETP _i_o_c_t_ls (see the SSuummmmaarryy below).
  148.  
  149.      In cooked mode, terminal input is processed in units of
  150.      lines.  A program attempting to read will normally be
  151.      suspended until an entire line has been received (but see
  152.      the description of SIGTTIN in JJoobb aacccceessss ccoonnttrrooll and of
  153.      FIONREAD in SSuummmmaarryy, both below.) No matter how many charac-
  154.      ters are requested in the read call, at most one line will
  155.      be returned.  It is not, however, necessary to read a whole
  156.      line at once; any number of characters may be requested in a
  157.      read, even one, without losing information.
  158.  
  159.      During input, line editing is normally done, with the erase
  160.      character _s_g__e_r_a_s_e (by default, DELETE) logically erasing
  161.      the last character typed and the _s_g__k_i_l_l character (default,
  162.      ^U: control-U) logically erasing the entire current input
  163.      line.  These characters never erase beyond the beginning of
  164.      the current input line or an eof.  These characters may be
  165.      entered literally by preceding them with `\'; the `\' will
  166.      normally be erased when the character is typed.
  167.  
  168.      The drivers normally treat either a carriage return or a
  169.      newline character as terminating an input line, replacing
  170.      the return with a newline and echoing a return and a line
  171.      feed.  If the CRMOD bit is cleared in the local mode word
  172.      then the processing for carriage return is disabled, and it
  173.      is simply echoed as a return, and does not terminate cooked
  174.      mode input.
  175.  
  176.      In the new driver there is a literal-next character (nor-
  177.      mally ^V) which can be typed in both cooked and CBREAK mode
  178.      preceding _a_n_y character to prevent its special meaning to
  179.      the terminal handler.  This is to be preferred to the use of
  180.      `\' escaping erase and kill characters, but `\' is retained
  181.      with its old function in the new line discipline.
  182.  
  183.      The new terminal driver also provides two other editing
  184.      characters in normal mode.  The word-erase character, nor-
  185.      mally ^W, erases the preceding word, but not any spaces
  186.      before it.  For the purposes of ^W, a word is defined as a
  187.      sequence of non-blank characters, with tabs counted as
  188.      blanks.  Finally, the reprint character, normally ^R,
  189.      retypes the pending input beginning on a new line.  Retyping
  190.      occurs automatically in cooked mode if characters which
  191.      would normally be erased from the screen are fouled by
  192.  
  193.  
  194.  
  195. Sprite v1.0               May 19, 1986                          3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. TTY                          Devices                          TTY
  203.  
  204.  
  205.  
  206.      program output.
  207.  
  208.      IInnppuutt eecchhooiinngg aanndd rreeddiissppllaayy
  209.  
  210.      The terminal driver has several modes (not present in stan-
  211.      dard UNIX Version 7 systems) for handling the echoing of
  212.      terminal input, controlled by bits in a local mode word.
  213.  
  214.      _H_a_r_d_c_o_p_y _t_e_r_m_i_n_a_l_s. When a hardcopy terminal is in use, the
  215.      LPRTERA bit is normally set in the local mode word.  Charac-
  216.      ters which are logically erased are then printed out back-
  217.      wards preceded by `\' and followed by `/' in this mode.
  218.  
  219.      _C_R_T _t_e_r_m_i_n_a_l_s. When a CRT terminal is in use, the LCRTBS bit
  220.      is normally set in the local mode word.  The terminal driver
  221.      then echoes the proper number of erase characters when input
  222.      is erased; in the normal case where the erase character is a
  223.      ^H this causes the cursor of the terminal to back up to
  224.      where it was before the logically erased character was
  225.      typed.  If the input has become fouled due to interspersed
  226.      asynchronous output, the input is automatically retyped.
  227.  
  228.      _E_r_a_s_i_n_g _c_h_a_r_a_c_t_e_r_s _f_r_o_m _a _C_R_T. When a CRT terminal is in
  229.      use, the LCRTERA bit may be set to cause input to be erased
  230.      from the screen with a "backspace-space-backspace" sequence
  231.      when character or word deleting sequences are used.  A
  232.      LCRTKIL bit may be set as well, causing the input to be
  233.      erased in this manner on line kill sequences as well.
  234.  
  235.      _E_c_h_o_i_n_g _o_f _c_o_n_t_r_o_l _c_h_a_r_a_c_t_e_r_s. If the LCTLECH bit is set in
  236.      the local state word, then non-printing (control) characters
  237.      are normally echoed as ^X (for some X) rather than being
  238.      echoed unmodified; delete is echoed as ^?.
  239.  
  240.      The normal modes for use on CRT terminals are speed depen-
  241.      dent.  At speeds less than 1200 baud, the LCRTERA and
  242.      LCRTKILL processing is painfully slow, and _s_t_t_y(1) normally
  243.      just sets LCRTBS and LCTLECH; at speeds of 1200 baud or
  244.      greater all of these bits are normally set.  _S_t_t_y(1) summar-
  245.      izes these option settings and the use of the new terminal
  246.      driver as "newcrt."
  247.  
  248.      OOuuttppuutt pprroocceessssiinngg..
  249.  
  250.      When one or more characters are written, they are actually
  251.      transmitted to the terminal as soon as previously-written
  252.      characters have finished typing.  (As noted above, input
  253.      characters are normally echoed by putting them in the output
  254.      queue as they arrive.) When a process produces characters
  255.      more rapidly than they can be typed, it will be suspended
  256.      when its output queue exceeds some limit.  When the queue
  257.      has drained down to some threshold the program is resumed.
  258.  
  259.  
  260.  
  261. Sprite v1.0               May 19, 1986                          4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. TTY                          Devices                          TTY
  269.  
  270.  
  271.  
  272.      Even parity is normally generated on output.  The EOT char-
  273.      acter is not transmitted in cooked mode to prevent terminals
  274.      that respond to it from hanging up; programs using RAW or
  275.      CBREAK mode should be careful.
  276.  
  277.      The Sprite terminal driver does not provide any automatic
  278.      delay generation on output;  the related bits in the tty
  279.      flags word are ignored.  Sprite also does not provide
  280.      automatic mapping between upper and lower case on terminals
  281.      lacking lower case; we assume that such terminals have long
  282.      since become extinct.
  283.  
  284.      Finally, there is a output flush character, normally ^O,
  285.      which sets the LFLUSHO bit in the local mode word, causing
  286.      subsequent output to be flushed until it is cleared by a
  287.      program or more input is typed.  This character has effect
  288.      in both cooked and CBREAK modes and causes pending input to
  289.      be retyped if there is any pending input.  An _i_o_c_t_l to flush
  290.      the characters in the input or output queues, TIOCFLUSH, is
  291.      also available.
  292.  
  293.      UUppppeerr ccaassee tteerrmmiinnaallss aanndd HHaazzeellttiinneess
  294.  
  295.      Sprite does not support the LCASE tty flag or the LTILDE bit
  296.      of the local mode word.
  297.  
  298.      FFllooww ccoonnttrrooll..
  299.  
  300.      There are two characters (the stop character, normally ^S,
  301.      and the start character, normally ^Q) which cause output to
  302.      be suspended and resumed respectively.  Extra stop charac-
  303.      ters typed when output is already stopped have no effect,
  304.      unless the start and stop characters are made the same, in
  305.      which case output resumes.
  306.  
  307.      Sprite does not support the TANDEM mode.
  308.  
  309.      LLiinnee ccoonnttrrooll aanndd bbrreeaakkss..
  310.  
  311.      There are several _i_o_c_t_l calls available to control the state
  312.      of the terminal line.  The TIOCSBRK _i_o_c_t_l will set the break
  313.      bit in the hardware interface causing a break condition to
  314.      exist; this can be cleared (usually after a delay with
  315.      _s_l_e_e_p(3)) by TIOCCBRK.  Break conditions in the input are
  316.      reflected as a null character in RAW mode or as the inter-
  317.      rupt character in cooked or CBREAK mode.  The TIOCCDTR _i_o_c_t_l
  318.      will clear the data terminal ready condition; it can be set
  319.      again by TIOCSDTR.
  320.  
  321.      When the carrier signal from the dataset drops (usually
  322.      because the user has hung up his terminal) a SIGHUP hangup
  323.      signal is sent to the processes in the distinguished process
  324.  
  325.  
  326.  
  327. Sprite v1.0               May 19, 1986                          5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. TTY                          Devices                          TTY
  335.  
  336.  
  337.  
  338.      group of the terminal; this usually causes them to ter-
  339.      minate.  The SIGHUP can be suppressed by setting the LNOHANG
  340.      bit in the local state word of the driver.  Access to the
  341.      terminal by other processes is then normally revoked, so any
  342.      further reads will fail, and programs that read a terminal
  343.      and test for end-of-file on their input will terminate
  344.      appropriately.  Note: Sprite provides only partial support
  345.      for modems at present.
  346.  
  347.      It is possible to ask that the phone line be hung up on the
  348.      last close with the TIOCHPCL _i_o_c_t_l; this is normally done on
  349.      the outgoing lines and dialups.
  350.  
  351.      IInntteerrrruupptt cchhaarraacctteerrss..
  352.  
  353.      There are several characters that generate interrupts in
  354.      cooked and CBREAK mode; all are sent to the processes in the
  355.      control group of the terminal, as if a TIOCGPGRP _i_o_c_t_l were
  356.      done to get the process group and then a _k_i_l_l_p_g(2) system
  357.      call were done, except that these characters also flush
  358.      pending input and output when typed at a terminal ('_a`'_l_a
  359.      TIOCFLUSH).  The characters shown here are the defaults; the
  360.      field names in the structures (given below) are also shown.
  361.      The characters may be changed.
  362.  
  363.      ^C   tt__iinnttrrcc (ETX) generates a SIGINT signal.  This is the
  364.           normal way to stop a process which is no longer
  365.           interesting, or to regain control in an interactive
  366.           program.
  367.  
  368.      ^\   tt__qquuiittcc (FS) generates a SIGQUIT signal.  This is used
  369.           to cause a program to terminate and produce a core
  370.           image, if possible, in the file ccoorree in the current
  371.           directory.
  372.  
  373.      ^Z   tt__ssuussppcc (EM) generates a SIGTSTP signal, which is used
  374.           to suspend the current process group.
  375.  
  376.      ^Y   tt__ddssuussppcc (SUB) generates a SIGTSTP signal as ^Z does,
  377.           but the signal is sent when a program attempts to read
  378.           the ^Y, rather than when it is typed.
  379.  
  380.      JJoobb aacccceessss ccoonnttrrooll..
  381.  
  382.      When using the new terminal driver, if a process which is
  383.      not in the distinguished process group of its control termi-
  384.      nal attempts to read from that terminal its process group is
  385.      sent a SIGTTIN signal.  This signal normally causes the
  386.      members of that process group to stop. If, however, the pro-
  387.      cess is ignoring SIGTTIN, has SIGTTIN blocked, or is in the
  388.      middle of process creation using _v_f_o_r_k(2)), the read will
  389.      return -1 and set _e_r_r_n_o to EIO.
  390.  
  391.  
  392.  
  393. Sprite v1.0               May 19, 1986                          6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. TTY                          Devices                          TTY
  401.  
  402.  
  403.  
  404.      When using the new terminal driver with the LTOSTOP bit set
  405.      in the local modes, a process is prohibited from writing on
  406.      its control terminal if it is not in the distinguished pro-
  407.      cess group for that terminal.  Processes which are holding
  408.      or ignoring SIGTTOU signals or which are in the middle of a
  409.      _v_f_o_r_k(2) are excepted and allowed to produce output.
  410.      TTeerrmmiinnaall//wwiinnddooww ssiizzeess.. In order to accommodate terminals and
  411.      workstations with variable-sized windows, the terminal
  412.      driver provides a mechanism for obtaining and setting the
  413.      current terminal size.  The driver does not use this infor-
  414.      mation internally, but only stores it and provides a uniform
  415.      access mechanism.  When the size is changed, a SIGWINCH sig-
  416.      nal is sent to the terminal's process group so that
  417.      knowledgeable programs may detect size changes.  This facil-
  418.      ity was added in 4.3BSD and is not available in earlier ver-
  419.      sions of the system.
  420.  
  421.      SSuummmmaarryy ooff mmooddeess..
  422.  
  423.      Unfortunately, due to the evolution of the terminal driver,
  424.      there are 4 different structures which contain various por-
  425.      tions of the driver data.  The first of these (ssggttttyybb) con-
  426.      tains that part of the information largely common between
  427.      version 6 and version 7 UNIX systems.  The second contains
  428.      additional control characters added in version 7.  The third
  429.      is a word of local state added in 4BSD, and the fourth is
  430.      another structure of special characters added for the new
  431.      driver.  In the future a single structure may be made avail-
  432.      able to programs which need to access all this information;
  433.      most programs need not concern themselves with all this
  434.      state.
  435.  
  436.      _B_a_s_i_c _m_o_d_e_s: _s_g_t_t_y.
  437.  
  438.      The basic _i_o_c_t_ls use the structure defined in <_s_g_t_t_y._h>:
  439.  
  440.      ssttrruucctt ssggttttyybb {{
  441.           cchhaarr ssgg__iissppeeeedd;;
  442.           cchhaarr ssgg__oossppeeeedd;;
  443.           cchhaarr ssgg__eerraassee;;
  444.           cchhaarr ssgg__kkiillll;;
  445.           sshhoorrttssgg__ffllaaggss;;
  446.      }};;
  447.  
  448.      The _s_g__i_s_p_e_e_d and _s_g__o_s_p_e_e_d fields describe the input and
  449.      output speeds of the device according to the following
  450.      table, which corresponds to the DEC DH-11 interface.  If
  451.      other hardware is used, impossible speed changes are
  452.      ignored.  Symbolic values in the table are as defined in
  453.      <_s_g_t_t_y._h>.
  454.  
  455.      B0      0    (hang up dataphone)
  456.  
  457.  
  458.  
  459. Sprite v1.0               May 19, 1986                          7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. TTY                          Devices                          TTY
  467.  
  468.  
  469.  
  470.      B50     1    50 baud
  471.      B75     2    75 baud
  472.      B110    3    110 baud
  473.      B134    4    134.5 baud
  474.      B150    5    150 baud
  475.      B200    6    200 baud
  476.      B300    7    300 baud
  477.      B600    8    600 baud
  478.      B1200   9    1200 baud
  479.      B1800   10   1800 baud
  480.      B2400   11   2400 baud
  481.      B4800   12   4800 baud
  482.      B9600   13   9600 baud
  483.      EXTA    14   External A
  484.      EXTB    15   External B
  485.  
  486.      Code conversion and line control required for IBM 2741's
  487.      (134.5 baud) must be implemented by the user's program.  The
  488.      half-duplex line discipline required for the 202 dataset
  489.      (1200 baud) is not supplied; full-duplex 212 datasets work
  490.      fine.
  491.  
  492.      The _s_g__e_r_a_s_e and _s_g__k_i_l_l fields of the argument structure
  493.      specify the erase and kill characters respectively.
  494.      (Defaults are DELETE and ^U.)
  495.  
  496.      The _s_g__f_l_a_g_s field of the argument structure contains
  497.      several bits that determine the system's treatment of the
  498.      terminal:
  499.  
  500.      ALLDELAY 0177400 Delay algorithm selection
  501.      BSDELAY  0100000 Select backspace delays (not implemented):
  502.      BS0      0
  503.      BS1      0100000
  504.      VTDELAY  0040000 Select form-feed and vertical-tab delays (not supported in Sprite):
  505.      FF0      0
  506.      FF1      0040000
  507.      CRDELAY  0030000 Select carriage-return delays (not supported in Sprite):
  508.      CR0      0
  509.      CR1      0010000
  510.      CR2      0020000
  511.      CR3      0030000
  512.      TBDELAY  0006000 Select tab delays (not supported in Sprite):
  513.      TAB0     0
  514.      TAB1     0002000
  515.      TAB2     0004000
  516.      XTABS    0006000
  517.      NLDELAY  0001400 Select new-line delays (not supported in Sprite):
  518.      NL0      0
  519.      NL1      0000400
  520.      NL2      0001000
  521.      NL3      0001400
  522.  
  523.  
  524.  
  525. Sprite v1.0               May 19, 1986                          8
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. TTY                          Devices                          TTY
  533.  
  534.  
  535.  
  536.      EVENP    0000200 Even parity allowed on input (ignored in Sprite)
  537.      ODDP     0000100 Odd parity allowed on input (ignored in Sprite)
  538.      RAW      0000040 Raw mode: wake up on all characters, 8-bit interface
  539.      CRMOD    0000020 Map CR into LF; output LF as CR-LF
  540.      ECHO     0000010 Echo (full duplex)
  541.      LCASE    0000004 Map upper case to lower on input and lower to upper on output
  542.      CBREAK   0000002 Return each character as soon as typed
  543.      TANDEM   0000001 Automatic flow control (not supported in Sprite)
  544.  
  545.      At present, Sprite does not generate any output delays, nor
  546.      does it generate or check parity.
  547.  
  548.      RAW disables all processing save output flushing with
  549.      LFLUSHO; full 8 bits of input are given as soon as it is
  550.      available; all 8 bits are passed on output.  A break condi-
  551.      tion in the input is reported as a null character.  If the
  552.      input queue overflows in raw mode all data in the input and
  553.      output queues are discarded; this applies to both new and
  554.      old drivers.
  555.  
  556.      CRMOD causes input carriage returns to be turned into new-
  557.      lines, and output and echoed new-lines to be output as a
  558.      carriage return followed by a line feed.
  559.  
  560.      CBREAK is a sort of half-cooked (rare?) mode.  Programs can
  561.      read each character as soon as typed, instead of waiting for
  562.      a full line; all processing is done except the input edit-
  563.      ing: character and word erase and line kill, input reprint,
  564.      and the special treatment of \ and EOT are disabled.
  565.  
  566.      TANDEM mode is not supported in Sprite.
  567.  
  568.      NNoottee:: The same ``stop'' and ``start'' characters are used
  569.      for both directions of flow control; the _t__s_t_o_p_c character
  570.      is accepted on input as the character that stops output and
  571.      is produced on output as the character to stop input, and
  572.      the _t__s_t_a_r_t_c character is accepted on input as the character
  573.      that restarts output and is produced on output as the char-
  574.      acter to restart input.
  575.  
  576.      _B_a_s_i_c _i_o_c_t_l_s
  577.  
  578.      A large number of _i_o_c_t_l(2) calls apply to terminals.  Some
  579.      have the general form:
  580.  
  581.      ##iinncclluuddee <<ssggttttyy..hh>>
  582.  
  583.      iiooccttll((ffiillddeess,, ccooddee,, aarrgg))
  584.      ssttrruucctt ssggttttyybb **aarrgg;;
  585.  
  586.      The applicable codes are:
  587.  
  588.  
  589.  
  590.  
  591. Sprite v1.0               May 19, 1986                          9
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. TTY                          Devices                          TTY
  599.  
  600.  
  601.  
  602.      TIOCGETP       Fetch the basic parameters associated with
  603.                     the terminal, and store in the pointed-to
  604.                     _s_g_t_t_y_b structure.
  605.  
  606.      TIOCSETP       Set the parameters according to the pointed-
  607.                     to _s_g_t_t_y_b structure.  The interface delays
  608.                     until output is quiescent, then throws away
  609.                     any unread characters, before changing the
  610.                     modes.
  611.  
  612.      TIOCSETN       Set the parameters like TIOCSETP but do not
  613.                     delay or flush input.  Input is not
  614.                     preserved, however, when changing to or from
  615.                     RAW.
  616.  
  617.      With the following codes _a_r_g is ignored.
  618.  
  619.      TIOCEXCL       Set "exclusive-use" mode: no further opens
  620.                     are permitted until the file has been closed.
  621.  
  622.      TIOCNXCL       Turn off "exclusive-use" mode.
  623.  
  624.      TIOCHPCL       When the file is closed for the last time,
  625.                     hang up the terminal.  This is useful when
  626.                     the line is associated with an ACU used to
  627.                     place outgoing calls.
  628.  
  629.      With the following codes _a_r_g is a pointer to an iinntt.
  630.  
  631.      TIOCGETD       _a_r_g is a pointer to an iinntt into which is
  632.                     placed the current line discipline number.
  633.  
  634.      TIOCSETD       _a_r_g is a pointer to an iinntt whose value
  635.                     becomes the current line discipline number.
  636.  
  637.      TIOCFLUSH      If the iinntt pointed to by _a_r_g has a zero
  638.                     value, all characters waiting in input or
  639.                     output queues are flushed.  Otherwise, the
  640.                     value of the iinntt is for the FREAD and FWRITE
  641.                     bits defined in <<ssyyss//ffiillee..hh>>; if the FREAD
  642.                     bit is set, all characters waiting in input
  643.                     queues are flushed, and if the FWRITE bit is
  644.                     set, all characters waiting in output queues
  645.                     are flushed.
  646.  
  647.      The remaining calls are not available in vanilla version 7
  648.      UNIX.  In cases where arguments are required, they are
  649.      described; _a_r_g should otherwise be given as 0.
  650.  
  651.      TIOCSTI        the argument points to a character which the
  652.                     system pretends had been typed on the termi-
  653.                     nal.
  654.  
  655.  
  656.  
  657. Sprite v1.0               May 19, 1986                         10
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. TTY                          Devices                          TTY
  665.  
  666.  
  667.  
  668.      TIOCSBRK       the break bit is set in the terminal.
  669.  
  670.      TIOCCBRK       the break bit is cleared.
  671.  
  672.      TIOCSDTR       data terminal ready is set.
  673.  
  674.      TIOCCDTR       data terminal ready is cleared.
  675.  
  676.      TIOCSTOP       output is stopped as if the ``stop'' charac-
  677.                     ter had been typed.
  678.  
  679.      TIOCSTART      output is restarted as if the ``start'' char-
  680.                     acter had been typed.
  681.  
  682.      TIOCGPGRP      _a_r_g is a pointer to an iinntt into which is
  683.                     placed the process group ID of the process
  684.                     group for which this terminal is the control
  685.                     terminal.
  686.  
  687.      TIOCSPGRP      _a_r_g is a pointer to an iinntt which is the value
  688.                     to which the process group ID for this termi-
  689.                     nal will be set.
  690.  
  691.      TIOCOUTQ       not supported in Sprite.
  692.  
  693.      FIONREAD       returns in the iinntt pointed to by _a_r_g the
  694.                     number of characters immediately readable
  695.                     from the argument descriptor.  This works for
  696.                     files, pipes, and terminals.
  697.  
  698.      _T_c_h_a_r_s
  699.  
  700.      The second structure associated with each terminal specifies
  701.      characters that are special in both the old and new terminal
  702.      interfaces: The following structure is defined in
  703.      <_s_y_s/_i_o_c_t_l._h>, which is automatically included in <_s_g_t_t_y._h>:
  704.  
  705.      ssttrruucctt ttcchhaarrss {{
  706.           cchhaarr tt__iinnttrrcc;;  //** iinntteerrrruupptt **//
  707.           cchhaarr tt__qquuiittcc;;  //** qquuiitt **//
  708.           cchhaarr tt__ssttaarrttcc;; //** ssttaarrtt oouuttppuutt **//
  709.           cchhaarr tt__ssttooppcc;;  //** ssttoopp oouuttppuutt **//
  710.           cchhaarr tt__eeooffcc;;   //** eenndd--ooff--ffiillee **//
  711.           cchhaarr tt__bbrrkkcc;;   //** iinnppuutt ddeelliimmiitteerr ((lliikkee nnll)) **//
  712.      }};;
  713.  
  714.      The default values for these characters are ^C, ^\, ^Q, ^S,
  715.      ^D, and -1.  A character value of -1 eliminates the effect
  716.      of that character.  The _t__b_r_k_c character, by default -1,
  717.      acts like a new-line in that it terminates a `line,' is
  718.      echoed, and is passed to the program.  The `stop' and
  719.      `start' characters may be the same, to produce a toggle
  720.  
  721.  
  722.  
  723. Sprite v1.0               May 19, 1986                         11
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. TTY                          Devices                          TTY
  731.  
  732.  
  733.  
  734.      effect.  It is probably counterproductive to make other spe-
  735.      cial characters (including erase and kill) identical.  The
  736.      applicable _i_o_c_t_l calls are:
  737.  
  738.      TIOCGETC    Get the special characters and put them in the
  739.                  specified structure.
  740.  
  741.      TIOCSETC    Set the special characters to those given in the
  742.                  structure.
  743.  
  744.      _L_o_c_a_l _m_o_d_e
  745.  
  746.      The third structure associated with each terminal is a local
  747.      mode word.  The bits of the local mode word are:
  748.  
  749.      LCRTBS    000001    Backspace on erase rather than echoing erase
  750.      LPRTERA   000002    Printing terminal erase mode
  751.      LCRTERA   000004    Erase character echoes as backspace-space-backspace
  752.      LTILDE    000010    Convert ~ to ` on output (not supported in Sprite)
  753.      LMDMBUF   000020    Stop/start output when carrier drops (not supported in Sprite)
  754.      LLITOUT   000040    Suppress output translations
  755.      LTOSTOP   000100    Send SIGTTOU for background output (not supported in Sprite)
  756.      LFLUSHO   000200    Output is being flushed
  757.      LNOHANG   000400    Don't send hangup when carrier drops (not supported in Sprite)
  758.      LETXACK   001000    Diablo style buffer hacking (unimplemented)
  759.      LCRTKIL   002000    BS-space-BS erase entire line on line kill
  760.      LPASS8    004000    Pass all 8 bits through on input, in any mode (not supported in Sprite)
  761.      LCTLECH   010000    Echo input control chars as ^X, delete as ^?
  762.      LPENDIN   020000    Retype pending input at next read or input character
  763.      LDECCTQ   040000    Only ^Q restarts output after ^S, like DEC systems (not supported in Sprite)
  764.      LNOFLSH   100000    Inhibit flushing of pending I/O when an interrupt character is typed (not supported in Sprite)
  765.  
  766.      The applicable _i_o_c_t_l functions are:
  767.  
  768.      TIOCLBIS       _a_r_g is a pointer to an iinntt whose value is a
  769.                     mask containing the bits to be set in the
  770.                     local mode word.
  771.  
  772.      TIOCLBIC       _a_r_g is a pointer to an iinntt whose value is a
  773.                     mask containing the bits to be cleared in the
  774.                     local mode word.
  775.  
  776.      TIOCLSET       _a_r_g is a pointer to an iinntt whose value is
  777.                     stored in the local mode word.
  778.  
  779.      TIOCLGET       _a_r_g is a pointer to an iinntt into which the
  780.                     current local mode word is placed.
  781.  
  782.      _L_o_c_a_l _s_p_e_c_i_a_l _c_h_a_r_s
  783.  
  784.      The final control structure associated with each terminal is
  785.      the _l_t_c_h_a_r_s structure which defines control characters for
  786.  
  787.  
  788.  
  789. Sprite v1.0               May 19, 1986                         12
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. TTY                          Devices                          TTY
  797.  
  798.  
  799.  
  800.      the new terminal driver.  Its structure is:
  801.  
  802.      ssttrruucctt llttcchhaarrss {{
  803.           cchhaarr tt__ssuussppcc;;  //** ssttoopp pprroocceessss ssiiggnnaall **//
  804.           cchhaarr tt__ddssuussppcc;; //** ddeellaayyeedd ssttoopp pprroocceessss ssiiggnnaall **//
  805.           cchhaarr tt__rrpprrnnttcc;; //** rreepprriinntt lliinnee **//
  806.           cchhaarr tt__fflluusshhcc;; //** fflluusshh oouuttppuutt ((ttoogggglleess)) **//
  807.           cchhaarr tt__wweerraasscc;; //** wwoorrdd eerraassee **//
  808.           cchhaarr tt__llnneexxttcc;; //** lliitteerraall nneexxtt cchhaarraacctteerr **//
  809.      }};;
  810.  
  811.      The default values for these characters are ^Z, ^Y, ^R, ^O,
  812.      ^W, and ^V.  A value of -1 disables the character.
  813.  
  814.      The applicable _i_o_c_t_l functions are:
  815.  
  816.      TIOCSLTC    _a_r_g is a pointer to an _l_t_c_h_a_r_s structure which
  817.                  defines the new local special characters.
  818.  
  819.      TIOCGLTC    _a_r_g is a pointer to an _l_t_c_h_a_r_s structure into
  820.                  which is placed the current set of local special
  821.                  characters.
  822.  
  823.      _W_i_n_d_o_w/_t_e_r_m_i_n_a_l _s_i_z_e_s
  824.  
  825.      Each terminal has provision for storage of the current ter-
  826.      minal or window size in a _w_i_n_s_i_z_e structure, with format:
  827.  
  828.      ssttrruucctt wwiinnssiizzee {{
  829.           uunnssiiggnneedd sshhoorrtt    wwss__rrooww;;        //** rroowwss,, iinn cchhaarraacctteerrss **//
  830.           uunnssiiggnneedd sshhoorrtt    wwss__ccooll;;        //** ccoolluummnnss,, iinn cchhaarraacctteerrss **//
  831.           uunnssiiggnneedd sshhoorrtt    wwss__xxppiixxeell;;     //** hhoorriizzoonnttaall ssiizzee,, ppiixxeellss **//
  832.           uunnssiiggnneedd sshhoorrtt    wwss__yyppiixxeell;;     //** vveerrttiiccaall ssiizzee,, ppiixxeellss **//
  833.      }};;
  834.  
  835.      A value of 0 in any field is interpreted as ``undefined;''
  836.      the entire structure is zeroed on final close.
  837.  
  838.      The applicable _i_o_c_t_l functions are:
  839.  
  840.      TIOCGWINSZ
  841.           _a_r_g is a pointer to a ssttrruucctt wwiinnssiizzee into which will be
  842.           placed the current terminal or window size information.
  843.  
  844.      TIOCSWINSZ
  845.           _a_r_g is a pointer to a ssttrruucctt wwiinnssiizzee which will be used
  846.           to set the current terminal or window size information.
  847.           If the new information is different than the old infor-
  848.           mation, a SIGWINCH signal will be sent to the
  849.           terminal's process group.
  850.  
  851.  
  852.  
  853.  
  854.  
  855. Sprite v1.0               May 19, 1986                         13
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. TTY                          Devices                          TTY
  863.  
  864.  
  865.  
  866. FFIILLEESS
  867.      /dev/tty
  868.      /dev/tty*
  869.      /dev/console
  870.  
  871. SSEEEE AALLSSOO
  872.      csh(1), stty(1), tset(1), ioctl(2), sigvec(2), stty(3C),
  873.      getty(8)
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921. Sprite v1.0               May 19, 1986                         14
  922.  
  923.  
  924.  
  925.